﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using DTO;
using System.Data.SqlClient;

namespace DAO
{
    public class ThongTinDAO
    {
        public DataTable LoaiChuyen()
        {
            DataTable dt = null;
            DataProvider dp = new DataProvider();
            dt = dp.SqlExcuteQuery("sp_LoaiChuyen");
            return dt;
        }
        public DataTable DiaDiem()
        {
            DataTable dt = null;
            DataProvider dp = new DataProvider();
            dt = dp.SqlExcuteQuery("sp_DiaDiem");
            return dt;
        }
        public DataTable LoaiGhe()
        {
            DataTable dt = null;
            DataProvider dp = new DataProvider();
            dt = dp.SqlExcuteQuery("sp_LoaiGhe");
            return dt;
        }
        public DataTable DoiTuong()
        {
            DataTable dt = null;
            DataProvider dp = new DataProvider();
            dt = dp.SqlExcuteQuery("sp_DoiTuong");
            return dt;
        }
        public DataTable GioiTinh()
        {
            DataTable dt = null;
            DataProvider dp = new DataProvider();
            dt = dp.SqlExcuteQuery("sp_GioiTinh");
            return dt;
        }
        public DataTable Ve()
        {
            DataTable dt = null;
            DataProvider dp = new DataProvider();
            dt = dp.SqlExcuteQuery("sp_TatCaVe");
            return dt;
        }
        public DataTable DanhSachVeCanXuLy()
        {
            DataTable dt = null;
            DataProvider dp = new DataProvider();
            dt = dp.SqlExcuteQuery("sp_DanhSachVeCanXuLy");
            return dt;
        }
        public DataTable HienTrang()
        {
            DataTable dt = null;
            DataProvider dp = new DataProvider();
            dt = dp.SqlExcuteQuery("sp_HienTrang");
            return dt;
        }
        public DataTable ThongTinChuyenTau(ThongTinDTO _tt)
        {
            DataTable dt = null;
            DataProvider dp = new DataProvider();
            List<SqlParameter> para = new List<SqlParameter>();
            para.Add(new SqlParameter("@LoaiChuyen", _tt.LoaiChuyen));
            para.Add(new SqlParameter("@DiaDiemDi", _tt.DiaDiemDi));
            para.Add(new SqlParameter("@DiaDiemDen", _tt.DiaDiemDen));
            para.Add(new SqlParameter("@LoaiGhe", _tt.LoaiGhe));
            dt = dp.SqlExcuteQuery("sp_LayThongTinChuyenTau", para.ToArray());
            return dt;
        }
        public DataTable DanhSachCacNoiDiQua(ThongTinDTO _tt)
        {
            DataTable dt = null;
            DataProvider dp = new DataProvider();
            List<SqlParameter> para = new List<SqlParameter>();
            para.Add(new SqlParameter("@DiaDiemDi", _tt.DiaDiemDi));
            para.Add(new SqlParameter("@DiaDiemDen", _tt.DiaDiemDen));
            dt = dp.SqlExcuteQuery("sp_DanhSachCacNoiDiQua", para.ToArray());
            return dt;
        }

        public DataTable ThongTinThanhToan(ThongTinDTO _tt)
        {
            DataTable dt = null;
            DataProvider dp = new DataProvider();
            List<SqlParameter> para = new List<SqlParameter>();
            para.Add(new SqlParameter("@HoTen", _tt.HoTen));
            para.Add(new SqlParameter("@GioiTinh", _tt.GioiTinh));
            para.Add(new SqlParameter("@CMND", _tt.CMND));
            para.Add(new SqlParameter("@DiaChi", _tt.DiaChi));
            para.Add(new SqlParameter("@DienThoai", _tt.DienThoai));
            para.Add(new SqlParameter("@DoiTuong", _tt.DoiTuong));
            para.Add(new SqlParameter("@GiaVe", _tt.GiaVe));
            para.Add(new SqlParameter("@MaChuyenTau", _tt.MaChuyenTau));
            para.Add(new SqlParameter("@NgayDen", _tt.NgayDen));
            para.Add(new SqlParameter("@VeTapThe", _tt.VeTapThe));
            para.Add(new SqlParameter("@SoLuongNguoi", _tt.SoLuongNguoi));
            para.Add(new SqlParameter("@LoaiGhe", _tt.LoaiGhe));
            para.Add(new SqlParameter("@TinhTrangVe", _tt.TinhTrangVe));
            dt = dp.SqlExcuteQuery("sp_ThanhToan", para.ToArray());
            return dt;
        }
        public DataTable ThongTinMotVe(ThongTinDTO _tt)
        {
            DataTable dt = null;
            DataProvider dp = new DataProvider();
            List<SqlParameter> para = new List<SqlParameter>();
            para.Add(new SqlParameter("@MaVe", _tt.MaVe));
            dt = dp.SqlExcuteQuery("sp_ThongTinMotVe", para.ToArray());
            return dt;
        }

        public DataTable ThemTraDoiVe(ThongTinDTO _tt)
        {
            DataTable dt = null;
            DataProvider dp = new DataProvider();
            List<SqlParameter> para = new List<SqlParameter>();
            para.Add(new SqlParameter("@MaVe", _tt.MaVe));
            para.Add(new SqlParameter("@LyDo", _tt.LyDo));
            para.Add(new SqlParameter("@HienTrang", _tt.HienTrang));
            para.Add(new SqlParameter("@TinhTrangVe", _tt.TinhTrangVe));
            dt = dp.SqlExcuteQuery("sp_ThemTraDoiVe", para.ToArray());
            return dt;
        }

        public DataTable XuLyTraDoiVe(ThongTinDTO _tt)
        {
            DataTable dt = null;
            DataProvider dp = new DataProvider();
            List<SqlParameter> para = new List<SqlParameter>();
            para.Add(new SqlParameter("@MaVe", _tt.MaVe));
            dt = dp.SqlExcuteQuery("sp_XuLyTraDoiVe", para.ToArray());
            return dt;
        }

        public DataTable CapNhatHienTrangVe(ThongTinDTO _tt)
        {
            DataTable dt = null;
            DataProvider dp = new DataProvider();
            List<SqlParameter> para = new List<SqlParameter>();
            para.Add(new SqlParameter("@MaVe", _tt.MaVe));
            para.Add(new SqlParameter("@HienTrang", _tt.HienTrang));
            dt = dp.SqlExcuteQuery("sp_CapNhatHienTrangVe", para.ToArray());
            return dt;
        }
    }
}
